package jjn.round1;

/**
 * @author Jjn
 * @since 2022/9/9 00:21
 */
public class LeetCode1598_CrawlerLogFolder {

    public int minOperations(String[] logs) {
        if (logs == null || logs.length == 0) {
            return 0;
        }
        int steps = 0;
        for (String log : logs) {
            if ("./".equals(log)) {
                continue;
            }
            if ("../".equals(log)) {
                if (steps > 0) {
                    steps--;
                }
                continue;
            }
            steps++;
        }
        return Math.max(steps, 0);
    }
}
